﻿using KMSimulator.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BarrageGameAssistant.UIForms
{
    public partial class FrmMouseAction : Form
    {
        private bool _newFlag = true; //新建标记

        #region 属性
        /// <summary>
        /// 鼠标位置
        /// </summary>
        public System.Drawing.Point MouseLocation { get; set; }

        /// <summary>
        /// 鼠标动作
        /// </summary>
        public KMActionBase? MouseAction { get; set; }
        #endregion


        public FrmMouseAction()
        {
            InitializeComponent();
        }

        private void FrmMouseAction_Load(object sender, EventArgs e)
        {
            cbbActionType.SelectedIndex = 0;
            cbbMouseButton.SelectedIndex = 0;
            cbbDirection.SelectedIndex = 0;
            cbbExecuteMode.SelectedIndex = 0;
            nudRotation.Value = 120;
            nudExecuteCount.Value = 1;
            nudInterval.Value = 100;
            nudReleaseTime.Value = 100;
            nudDelay.Value = 100;

            if (MouseAction == null)
            {
                _newFlag = true;
            }
            else 
            {
                _newFlag = false;
            }

        }

        private void cbbActionType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbbActionType.SelectedIndex == 2)
            {
                this.cbbDirection.Enabled = true;
                this.nudRotation.Enabled = true;
                this.cbbMouseButton.Enabled = false;
            }
            else
            {
                this.cbbDirection.Enabled = false;
                this.nudRotation.Enabled = false;
                this.cbbMouseButton.Enabled = true;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {

        }
    }
}
